package org.hxzon.demo.jnative;
//由org.xvolks.jnative.com.typebrowser.gui.MainFrame自动生成。
import org.xvolks.jnative.com.interfaces.IDispatch;
import org.xvolks.jnative.misc.basicStructures.HWND;
import org.xvolks.jnative.util.constants.COM.DISPATCH_TYPE;
import org.xvolks.jnative.JNative;
import org.xvolks.jnative.com.typebrowser.business.COMIntrospector;
import org.xvolks.jnative.com.utils.ByRef;
import org.xvolks.jnative.com.utils.COMActuator;
import org.xvolks.jnative.logging.JNativeLogger;

public class GdctUkey extends IDispatch {
	public GdctUkey(Thread dispatchThread, HWND hwnd) throws Throwable {
		super("gdctukey.ukey.1", IIDIDispatch, dispatchThread, hwnd);
	}

	/**
	 * 方法Connect
	 */
	public Integer Connect(String AppKey, String Token, Integer ConnectMode, String Username, String Password, Integer TimeOut, org.xvolks.jnative.com.utils.ByRef<Integer> ErrorCode, org.xvolks.jnative.com.utils.ByRef<String> ErrorMsg) {
		Object[] params = new Object[8];
		params[0] = AppKey;
		params[1] = Token;
		params[2] = ConnectMode;
		params[3] = Username;
		params[4] = Password;
		params[5] = TimeOut;
		params[6] = ErrorCode;
		params[7] = ErrorMsg;
		return (Integer) invoke(1, DISPATCH_TYPE.DISPATCH_METHOD, params);
	}

	/**
	 * 方法Disconnect
	 */
	public Integer Disconnect(String AppKey, String Token) {
		Object[] params = new Object[2];
		params[0] = AppKey;
		params[1] = Token;
		return (Integer) invoke(2, DISPATCH_TYPE.DISPATCH_METHOD, params);
	}

	/**
	 * 方法GetConnectMode
	 */
	public Integer GetConnectMode(String AppKey, String Token, org.xvolks.jnative.com.utils.ByRef<Integer> Value) {
		Object[] params = new Object[3];
		params[0] = AppKey;
		params[1] = Token;
		params[2] = Value;
		return (Integer) invoke(3, DISPATCH_TYPE.DISPATCH_METHOD, params);
	}

	/**
	 * 方法GetRSSI
	 */
	public Integer GetRSSI(String AppKey, String Token, org.xvolks.jnative.com.utils.ByRef<Integer> Value) {
		Object[] params = new Object[3];
		params[0] = AppKey;
		params[1] = Token;
		params[2] = Value;
		return (Integer) invoke(4, DISPATCH_TYPE.DISPATCH_METHOD, params);
	}

	/**
	 * 方法WriteData
	 */
	public Integer WriteData(String AppKey, String Token, String id, String data) {
		Object[] params = new Object[4];
		params[0] = AppKey;
		params[1] = Token;
		params[2] = id;
		params[3] = data;
		return (Integer) invoke(5, DISPATCH_TYPE.DISPATCH_METHOD, params);
	}

	/**
	 * 方法AppendData
	 */
	public Integer AppendData(String AppKey, String Token, String id, String data) {
		Object[] params = new Object[4];
		params[0] = AppKey;
		params[1] = Token;
		params[2] = id;
		params[3] = data;
		return (Integer) invoke(6, DISPATCH_TYPE.DISPATCH_METHOD, params);
	}

	/**
	 * 方法RemoveData
	 */
	public Integer RemoveData(String AppKey, String Token, String id) {
		Object[] params = new Object[3];
		params[0] = AppKey;
		params[1] = Token;
		params[2] = id;
		return (Integer) invoke(7, DISPATCH_TYPE.DISPATCH_METHOD, params);
	}

	/**
	 * 方法ReadData
	 */
	public Integer ReadData(String AppKey, String Token, String id, org.xvolks.jnative.com.utils.ByRef<String> data) {
		Object[] params = new Object[4];
		params[0] = AppKey;
		params[1] = Token;
		params[2] = id;
		params[3] = data;
		return (Integer) invoke(8, DISPATCH_TYPE.DISPATCH_METHOD, params);
	}

	/**
	 * 方法ClearData
	 */
	public Integer ClearData(String AppKey, String Token) {
		Object[] params = new Object[2];
		params[0] = AppKey;
		params[1] = Token;
		return (Integer) invoke(9, DISPATCH_TYPE.DISPATCH_METHOD, params);
	}

	/**
	 * 方法GetAllID
	 */
	public Integer GetAllID(String AppKey, String Token, org.xvolks.jnative.com.utils.ByRef<String> Value) {
		Object[] params = new Object[3];
		params[0] = AppKey;
		params[1] = Token;
		params[2] = Value;
		return (Integer) invoke(10, DISPATCH_TYPE.DISPATCH_METHOD, params);
	}

	/**
	 * 方法RegisterCertificate
	 */
	public Integer RegisterCertificate(String AppKey, String Token) {
		Object[] params = new Object[2];
		params[0] = AppKey;
		params[1] = Token;
		return (Integer) invoke(11, DISPATCH_TYPE.DISPATCH_METHOD, params);
	}

	/**
	 * 方法UnregisterCertificate
	 */
	public Integer UnregisterCertificate(String AppKey, String Token) {
		Object[] params = new Object[2];
		params[0] = AppKey;
		params[1] = Token;
		return (Integer) invoke(12, DISPATCH_TYPE.DISPATCH_METHOD, params);
	}

	/**
	 * 方法Sign
	 */
	public Integer Sign(String AppKey, String Token, String Src, org.xvolks.jnative.com.utils.ByRef<String> Dest) {
		Object[] params = new Object[4];
		params[0] = AppKey;
		params[1] = Token;
		params[2] = Src;
		params[3] = Dest;
		return (Integer) invoke(13, DISPATCH_TYPE.DISPATCH_METHOD, params);
	}

	/**
	 * 方法VerifySign
	 */
	public Integer VerifySign(String AppKey, String Token, String SignStr, String SignCert, org.xvolks.jnative.com.utils.ByRef<Integer> Value) {
		Object[] params = new Object[5];
		params[0] = AppKey;
		params[1] = Token;
		params[2] = SignStr;
		params[3] = SignCert;
		params[4] = Value;
		return (Integer) invoke(14, DISPATCH_TYPE.DISPATCH_METHOD, params);
	}

	/**
	 * 方法Encrypt
	 */
	public Integer Encrypt(String AppKey, String Token, String Src, org.xvolks.jnative.com.utils.ByRef<String> Dest) {
		Object[] params = new Object[4];
		params[0] = AppKey;
		params[1] = Token;
		params[2] = Src;
		params[3] = Dest;
		return (Integer) invoke(15, DISPATCH_TYPE.DISPATCH_METHOD, params);
	}

	/**
	 * 方法Decrypt
	 */
	public Integer Decrypt(String AppKey, String Token, String Src, org.xvolks.jnative.com.utils.ByRef<String> Dest) {
		Object[] params = new Object[4];
		params[0] = AppKey;
		params[1] = Token;
		params[2] = Src;
		params[3] = Dest;
		return (Integer) invoke(16, DISPATCH_TYPE.DISPATCH_METHOD, params);
	}

	/**
	 * 方法ChangePIN
	 */
	public Integer ChangePIN(String AppKey, String Token, String OldPIN, String NewPIN, org.xvolks.jnative.com.utils.ByRef<Integer> RetryNumber) {
		Object[] params = new Object[5];
		params[0] = AppKey;
		params[1] = Token;
		params[2] = OldPIN;
		params[3] = NewPIN;
		params[4] = RetryNumber;
		return (Integer) invoke(17, DISPATCH_TYPE.DISPATCH_METHOD, params);
	}

	/**
	 * 方法GetIMEI
	 */
	public Integer GetIMEI(String AppKey, String Token, org.xvolks.jnative.com.utils.ByRef<String> Value) {
		Object[] params = new Object[3];
		params[0] = AppKey;
		params[1] = Token;
		params[2] = Value;
		return (Integer) invoke(18, DISPATCH_TYPE.DISPATCH_METHOD, params);
	}

	/**
	 * 方法GetIMSI
	 */
	public Integer GetIMSI(String AppKey, String Token, org.xvolks.jnative.com.utils.ByRef<String> Value) {
		Object[] params = new Object[3];
		params[0] = AppKey;
		params[1] = Token;
		params[2] = Value;
		return (Integer) invoke(19, DISPATCH_TYPE.DISPATCH_METHOD, params);
	}

	/**
	 * 方法GetTaxpayerInformation
	 */
	public Integer GetTaxpayerInformation(org.xvolks.jnative.com.utils.ByRef<String> Value) {
		Object[] params = new Object[1];
		params[0] = Value;
		return (Integer) invoke(20, DISPATCH_TYPE.DISPATCH_METHOD, params);
	}

	/**
	 * 方法GetCAType
	 */
	public Integer GetCAType(org.xvolks.jnative.com.utils.ByRef<Integer> CaType) {
		Object[] params = new Object[1];
		params[0] = CaType;
		return (Integer) invoke(21, DISPATCH_TYPE.DISPATCH_METHOD, params);
	}

	/**
	 * 方法GetDeviceStatus
	 */
	public Integer GetDeviceStatus(String AppKey, String Token, org.xvolks.jnative.com.utils.ByRef<String> StatusCode, org.xvolks.jnative.com.utils.ByRef<String> StatusDescription) {
		Object[] params = new Object[4];
		params[0] = AppKey;
		params[1] = Token;
		params[2] = StatusCode;
		params[3] = StatusDescription;
		return (Integer) invoke(22, DISPATCH_TYPE.DISPATCH_METHOD, params);
	}

	/**
	 * 方法GetConnectState
	 */
	public Integer GetConnectState(String AppKey, String Token, org.xvolks.jnative.com.utils.ByRef<Integer> Value) {
		Object[] params = new Object[3];
		params[0] = AppKey;
		params[1] = Token;
		params[2] = Value;
		return (Integer) invoke(23, DISPATCH_TYPE.DISPATCH_METHOD, params);
	}

	/**
	 * 方法GetCertSerialNo
	 */
	public Integer GetCertSerialNo(String AppKey, String Token, org.xvolks.jnative.com.utils.ByRef<String> Value) {
		Object[] params = new Object[3];
		params[0] = AppKey;
		params[1] = Token;
		params[2] = Value;
		return (Integer) invoke(24, DISPATCH_TYPE.DISPATCH_METHOD, params);
	}

	/**
	 * 方法MobileConnected
	 */
	public Integer MobileConnected(String AppKey, String Token) {
		Object[] params = new Object[2];
		params[0] = AppKey;
		params[1] = Token;
		return (Integer) invoke(25, DISPATCH_TYPE.DISPATCH_METHOD, params);
	}

	/**
	 * 方法GetDeviceFreeSpace
	 */
	public Integer GetDeviceFreeSpace(String AppKey, String Token, org.xvolks.jnative.com.utils.ByRef<String> Value) {
		Object[] params = new Object[3];
		params[0] = AppKey;
		params[1] = Token;
		params[2] = Value;
		return (Integer) invoke(26, DISPATCH_TYPE.DISPATCH_METHOD, params);
	}

	/**
	 * 方法GetRandomGene
	 */
	public Integer GetRandomGene(String AppKey, String Token, org.xvolks.jnative.com.utils.ByRef<String> Value) {
		Object[] params = new Object[3];
		params[0] = AppKey;
		params[1] = Token;
		params[2] = Value;
		return (Integer) invoke(27, DISPATCH_TYPE.DISPATCH_METHOD, params);
	}

	/**
	 * 方法GetUkeyTime
	 */
	public Integer GetUkeyTime(String AppKey, String Token, org.xvolks.jnative.com.utils.ByRef<String> Value) {
		Object[] params = new Object[3];
		params[0] = AppKey;
		params[1] = Token;
		params[2] = Value;
		return (Integer) invoke(28, DISPATCH_TYPE.DISPATCH_METHOD, params);
	}

	/**
	 * 方法SetUkeyTime
	 */
	public Integer SetUkeyTime(String AppKey, String Token, String KeyTime) {
		Object[] params = new Object[3];
		params[0] = AppKey;
		params[1] = Token;
		params[2] = KeyTime;
		return (Integer) invoke(29, DISPATCH_TYPE.DISPATCH_METHOD, params);
	}

	/**
	 * 方法SetStatistics
	 */
	public Integer SetStatistics(String AppKey, String Token, String Host, String Port, String LogMsg) {
		Object[] params = new Object[5];
		params[0] = AppKey;
		params[1] = Token;
		params[2] = Host;
		params[3] = Port;
		params[4] = LogMsg;
		return (Integer) invoke(30, DISPATCH_TYPE.DISPATCH_METHOD, params);
	}

	public static void main(String[] args) throws Throwable {
//		System.setProperty(JNativeLogger.LOG_LEVEL, "5");
//		JNative.setLoggingEnabled(true);
		
		HWND hwnd = new HWND(0);
		ByRef<HWND> pHWND = new ByRef<HWND>(hwnd);
		// install the main message loop before opening a window !!!
		Thread t = COMActuator.installMainMessagePumpLoopInThread(pHWND);
		javax.swing.JFrame f = new javax.swing.JFrame();
		f.setVisible(true);
		System.err.println("SOP >>>>>>>>>>>>>>>>>>>>>>>>>>>");
		try {
			final GdctUkey lect = new GdctUkey(t, hwnd);
			lect.syncExec(new Runnable() {
				public void run() {
					try {
//						COMIntrospector.introspectIDispatch(lect);
						//add by hxzon for test
						ByRef<Integer> caType=new ByRef<Integer>(2);
						lect.GetCAType(caType);
						System.out.println(caType.getValue());
						ByRef<String> taxpayerInfo=new ByRef<String>("");
						lect.GetTaxpayerInformation(taxpayerInfo);
						System.out.println(taxpayerInfo);
						//end add by hxzon
					} catch (Exception e) {
						e.printStackTrace();
					}
				}
			});
		} finally {
			System.err.println("<<<<<<<<<<<<<<<<<<<<<<<<EOP");
			f.setVisible(false);
		}
	}
}
